/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Items;

import Map.Map;
import IO.Utils;
import IO.models.ItemsConfig;
import Map.MapLevel;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;

/**
 *
 * @author insane
 */
public class AddItems {

    public char[][] addUpTransitions(Map mp) {

        char[][] ismap = mp.getMap();
        boolean check = false;
        while (!check) {
            int x = Utils.rand(1, mp.getWidth() - 1);
            int y = Utils.rand(1, mp.getHeight() - 1);
            if (ismap[x][y] == '.') {
                ismap[x][y] = '<';
                check = true;
            }
        }
        return ismap;
    }

    public char[][] addDownTransitions(Map mp) {

        char[][] ismap = mp.getMap();
        boolean check = false;
        while (!check) {
            int x = Utils.rand(1, mp.getWidth() - 1);
            int y = Utils.rand(1, mp.getHeight() - 1);
            if (ismap[x][y] == '.') {
                ismap[x][y] = '>';
                check = true;
            }
        }
        return ismap;
    }

    public char[][] addItems(Map mp) {
        char[][] ismap = mp.getMap();
        int ic = mp.getHeight() / 8;
        for (int i = 0; i < ic; i++) {
            boolean check = false;
            while (!check) {
                int x = Utils.rand(1, mp.getWidth() - 1);
                int y = Utils.rand(1, mp.getHeight() - 1);
                if (ismap[x][y] == '.') {
                    ismap[x][y] = '*';
                    check = true;
                }
            }
        }
        return ismap;
    }

    public void getItem() throws FileNotFoundException, IOException, ClassNotFoundException{
        int level = MapLevel.getInstance().getLevel();
        ArrayList items = ItemsConfig.getInstance().getItems();
        for(int i = 0; i < items.size(); i ++)
        {
            ;
        }
    }
}
